﻿
@{
    ViewBag.Title = "HiddenTroubleAdd";
    Layout = "~/Views/Shared/_LayoutMain.cshtml";
}
@section css {
    <link href="~/Assets/css/lib/bootstrap-select.css" rel="stylesheet" />
    <link href="~/Assets/css/lib/bootstrap-datetimepicker.min.css" rel="stylesheet" />
    <link href="~/Assets/css/lib/fileinput.css" rel="stylesheet" />
    <style>
        th {
            text-align: center;
            font-weight: bold;
        }

        td {
            text-align: center;
            vertical-align: middle;
        }
    </style>
}
<div class="page-content" ng-cloak ng-controller="SafetyResponsibilityController" ng-init="AddModel={};page='@(Request.QueryString["page"].IsEmpty() ? "1" : Request.QueryString["page"])';
     Id='@(Request.QueryString["Id"].IsEmpty() ? "1" : Request.QueryString["Id"])';
     JobTitle='@(Request.QueryString["JobTitle"].IsEmpty() ? "" : Request.QueryString["JobTitle"])';
     AddModel.JobTitleId = Id;
     SearchModel={};
     BindDepartmentList('Dep_Select');
     GetUserList(SearchModel,Id);
     GetSelectedUserList(Id);
     ">
    <div class="load" ng-show="DataLoading">
        <div class="loader">
            <svg version="1.1" id="loader-1" x="0px" y="0px" width="100px" height="100px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
            <path fill="#000" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z">
            <animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite" />
			</path>
		    </svg>
            <div class="load-msg" ng-bind="LoadingMsg"></div>
        </div>
    </div>
    <div class="page-heading">
        <h1>岗位分配 {{JobTitle}}</h1>
        <div class="options">
            <div class="btn-toolbar">

            </div>
        </div>
    </div>
    <ol class="breadcrumb">
        <li><a>主体业务</a></li>
        <li><a>安全责任</a></li>
        <li><a>责任分配</a></li>
        <li class="active"><a>新增分配</a></li>
    </ol>
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-12">
                <div class="panel panel-default">
                    <div class="panel-heading"><h2>过滤</h2></div>
                    <div class="panel-body">
                        <form class="form-horizontal">
                            <div class="form-group">
                                <label class="col-sm-1 control-label">所在部门：</label>
                                <div class="col-sm-2">
                                    <select id="Dep_Select" class="selectpicker show-tick form-control" ng-model="SearchModel.DepartmentId" ng-change="GetUserList(SearchModel,Id);" data-live-search="true">
                                        <option value="" selected>所有部门</option>
                                    </select>
                                </div>
                                <div class="col-md-2">
                                    <input type="text" class="form-control" placeholder="工号" ng-model="SearchModel.UserNo" ng-change="GetUserList(SearchModel,Id);" />
                                </div>
                                <div class="col-md-2">
                                    <input type="text" class="form-control" placeholder="用户名" ng-model="SearchModel.UserName" ng-change="GetUserList(SearchModel,Id);" />
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <form class="form-horizontal row-border">
                <div class="col-md-6">
                    <div class="panel panel-default">
                        <div class="panel-heading"><h2>待选区</h2></div>
                        <div class="panel-body" style="max-height:450px;overflow-y:scroll;">
                            <table class="table table-striped table-bordered" ng-show="!DataLoading">
                                <thead>
                                    <tr>
                                        <th>序号</th>
                                        <th>工号</th>
                                        <th>姓名</th>
                                        <th>部门</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td colspan="5" ng-show="UserList==null || UserList.length==0">暂无可选人员</td>
                                    </tr>
                                    <tr ng-repeat="x in UserList" ng-show="UserList!=null && UserList.length>0">
                                        <td ng-bind="$index+1"></td>
                                        <td ng-bind="x.UserNo"></td>
                                        <td ng-bind="x.UserName"></td>
                                        <td ng-bind="x.DepartmentName"></td>
                                        <td><button ng-click="AddUserJobTitle(Id,x.UserNo,SearchModel);" type="button" class="btn btn-primary-alt">分配</button></td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="panel panel-default">
                        <div class="panel-heading"><h2>已选区</h2></div>
                        <div class="panel-body" style="max-height:450px;overflow-y:scroll;">
                            <table class="table table-striped table-bordered" ng-show="!DataLoading">
                                <thead>
                                    <tr>
                                        <th>序号</th>
                                        <th>工号</th>
                                        <th>姓名</th>
                                        <th>部门</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr ng-show="SelectedUserList==null || SelectedUserList.length==0">
                                        <td colspan="8" style="text-align:center;vertical-align:middle;line-height:30px;">没有数据</td>
                                    </tr>
                                    <tr ng-repeat="x in SelectedUserList" ng-show="SelectedUserList!=null && SelectedUserList.length>0">
                                        <td ng-bind="$index+1"></td>
                                        <td ng-bind="x.UserNo"></td>
                                        <td ng-bind="x.UserName"></td>
                                        <td ng-bind="x.DepartmentName"></td>
                                        <td><button type="button" ng-click="RemoveUserJobTitle(Id,x.UserNo,SearchModel);" class="btn btn-danger-alt">移除</button></td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </form>
        </div>
        <div class="row">
            <div class="col-md-5">
            </div>
            <div class="col-md-1">
                <a href="JobTitleToUser?page={{page}}" class="btn btn-danger">返回</a>
            </div> 
        </div>
    </div>

</div>


@section Js{
    <script src="~/Assets/js/pg/SafetyResponsibility.js"></script>
}
